#!/bin/bash
# cip 复制ip工具
# @Date    : 2018-05-02
# @Author  : Brook (liu785029095@gmail.com)
# @Link    : http://ganlu.ren
# @Version : 1.0.0

OSNAME=`uname`
ip=''
if [[ $OSNAME =~ "Linux" ]];then
    ip=`ifconfig | grep 'inet addr' | grep 'Bcast' | grep 'Mask' | awk -F ' ' '{print $2}' | awk -F ':' '{print $2}'`
else 
   ip=`ifconfig | grep 'inet' | grep 'broadcast' | grep 'mask' | awk -F ' ' '{print $2}'`
fi
`echo $ip|pbcopy`
echo "IP: $ip"